import { Controller, Post, Get, Put, Del, Query, Body } from '@midwayjs/core';
import { Inject } from '@midwayjs/core';
import { DPEngineInfoService } from '../service/EngineInfo.service';
import { DPEngineInfoCreateDto, DPEngineInfoUpdateDto, DPEngineInfoQueryDto, DPEngineInfoDeleteDto } from '../dto/EngineInfo.dto';

@Controller('/engine-info')
export class DPEngineInfoController {
  @Inject()
  dpEngineInfoService: DPEngineInfoService;

  // 添加引擎信息
  @Post('/add')
  async addEngineInfo(@Body() params: DPEngineInfoCreateDto) {
    const result = await this.dpEngineInfoService.addEngineInfo(params);
    return result;
  }

  // 获取所有引擎信息
  @Get('/all')
  async getAllEngineInfo() {
    const result = await this.dpEngineInfoService.getAllEngineInfo();
    return result;
  }

  // 根据查询条件获取引擎信息，支持分页
  @Get('/query')
  async findEngineInfo(@Query() query: DPEngineInfoQueryDto) {
    const result = await this.dpEngineInfoService.findEngineInfo(query);
    return result;
  }

  // 更新引擎信息
  @Put('/update')
  async updateEngineInfo(@Body() params: DPEngineInfoUpdateDto) {
    const result = await this.dpEngineInfoService.updateEngineInfo(params);
    return result;
  }

  // 删除引擎信息
  @Del('/delete')
  async deleteEngineInfo(@Body() params: DPEngineInfoDeleteDto) {
    const result = await this.dpEngineInfoService.deleteEngineInfo(params);
    return result;
  }
}
